package com.jingdun.sport.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jingdun.sport.bean.model.RoomAnswerRelation;
import com.jingdun.sport.bean.model.Questions;
import com.jingdun.sport.dao.RoomAnswerRelationMapper;
import com.jingdun.sport.service.RoomAnswerRelationService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
@Slf4j
@AllArgsConstructor
public class RoomAnswerRelationServiceImpl extends ServiceImpl<RoomAnswerRelationMapper, RoomAnswerRelation> implements RoomAnswerRelationService {

    private RoomAnswerRelationMapper roomAnswerRelationMapper;	
	
    public void addRoomAnswerRelation(RoomAnswerRelation roomAnswerRelation){
        roomAnswerRelationMapper.addRoomAnswerRelation(roomAnswerRelation);
    }

    public RoomAnswerRelation getRoomAnswerRelationDetail(@Param("params") Map<String, Object> m){
        return roomAnswerRelationMapper.getRoomAnswerRelationDetail(m);
    }
	
	public Page<Map<String, Object>> getPaginationRoomAnswerRelation(@Param("params") Map<String, Object> m){
        //新建分页
        Page<Map<String,Object>> page =new Page<Map<String,Object>>((long)m.get("current"), (long)m.get("size"));
        //返回结果
        page.setRecords(this.baseMapper.getPaginationRoomAnswerRelation(page, m));
        return page;
    }

    public void updateRoomAnswerRelation(RoomAnswerRelation roomAnswerRelation){
        roomAnswerRelationMapper.updateRoomAnswerRelation(roomAnswerRelation);
    }

}
